package com.vitabuybuy.tv.network

import com.library.common.net.NetUrl
import com.vitabuybuy.tv.dto.*
import rxhttp.IAwait
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse

/**
 * 作者：SimGa
 * 日期：2021/3/19
 * 时间：16:29
 * 包名：com.vitabuybuy.tv.network
 */

object TaskRepository {


    fun getTaskList(
        params: Map<String, Any>
    ): IAwait<MutableList<TaskPoolDto>> {
        return RxHttp.postJson(NetUrl.api_task_find_list)
            .addAll(params).toResponse()
    }

    fun getTaskManagerList(
        params: Map<String, Any>
    ): IAwait<MutableList<TaskManageListDto>> {
        return RxHttp.postJson(NetUrl.api_task_manager)
            .addAll(params).toResponse()
    }

    fun getTaskDetails(
        id: Int?
    ): IAwait<TaskPoolDetailDto> {
        return RxHttp.postJson(NetUrl.api_task_details)
            .add("id",id).toResponse()
    }

    fun getTaskMenagerDetails(
        id: Int?
    ): IAwait<TaskMenageDetailDto> {
        return RxHttp.postJson(NetUrl.api_task_manage_detail)
            .add("id",id).toResponse()
    }

    fun getTaskSign(
        params: Map<String, Any?>
    ): IAwait<String> {
        return RxHttp.postJson(NetUrl.api_task_sign)
            .addAll(params).toResponse()
    }
    fun cancelSign(
        params: Map<String, Any?>
    ): IAwait<String> {
        return RxHttp.postJson(NetUrl.api_cancel_apply_task)
            .addAll(params).toResponse()
    }

    fun refuseOrAgreeInvite(
        params: Map<String, Any?>
    ): IAwait<String> {
        return RxHttp.postJson(NetUrl.api_refuse_or_pass_task)
            .addAll(params).toResponse()
    }
}